package wfb.wfbdbimpl;
import wfb.definitions.CountryData;

import javax.persistence.*;
import java.io.Serializable;

/**
 * Land-Entity-Objekt
 * Hauptstadt, Organisationen, Links zu den Bildern müssen nachträglich gesetzt/ergänzt werden
 * TODO Kommentar
 * @author oni
 *
 */
@Entity
@Table( name = "dbprak13.LAENDER" )
public class Land extends CountryData implements Serializable{

	private String land;
	private String langname;
	private String hauptstadt;
	private Double longi;
	private Double lati;
	private String lage;
	private String info;
	private String flag_link;
	private String map_link;
	private String kommentar;
	
	public Land(){
		
	}
	
	public Land(String land, String langname, String hauptstadt,
			Double longitude, Double latitude, String lage, String info, 
			String flag_link, String map_link) {
		this.land = land;
		super.setName(land);
		this.langname = langname;
		super.setLongName(langname);
		this.hauptstadt = hauptstadt;
		this.longi = longitude;
		super.setLongitude(longitude.floatValue());
		this.lati = latitude;
		super.setLatitude(latitude.floatValue());
		this.lage = lage;
		super.setTextLage(lage);
		this.info = info;
		super.setTextInfo(info);
		this.flag_link=flag_link;
		super.setRefFlag(flag_link);
		this.map_link=map_link;
		super.setRefMap(map_link);
	}

	@Id
	public String getLand() {
		return land;
	}
	public void setLand(String land) {
		this.land = land;
		super.setName(land);
	}
	public String getLangname() {
		return langname;
	}
	public void setLangname(String langname) {
		this.langname = langname;
		super.setLongName(langname);
	}
	
	//@EmbeddedId
//	@OneToOne(/*cascade = CascadeType.ALL,*/ fetch= FetchType.LAZY)
//	@JoinColumn(name="land")
	public String getHauptstadt() {
		return hauptstadt;
	}
	public void setHauptstadt(String hauptstadt) {
		this.hauptstadt = hauptstadt;
	}
	@Column(name="longitude")
	public Double getLongi() {
		return longi;
	}
	public void setLongi(Double longi) {
		this.longi = longi;
		super.setLongitude((longi == null)? 0 : longi.floatValue());
	}
	@Column(name="latitude")
	public Double getLati() {
		return lati;
	}
	public void setLati(Double lati) {
		this.lati = lati;
		super.setLatitude((lati == null)? 0 : lati.floatValue());
	}
	public String getLage() {
		return lage;
	}
	public void setLage(String lage) {
		this.lage = lage;
		super.setTextLage(lage);
	}
	public String getInfo() {
		return info;
	}
	public void setInfo(String info) {
		this.info = info;
		super.setTextInfo(info);
	}
	
	@Column(name="flag_link")
	public String getFlagLink() {
		return flag_link;
	}
	public void setFlagLink(String flag_link) {
		this.flag_link = flag_link;
		super.setRefFlag(flag_link);
	}
	
	 @Column(name="map_link")
	public String getMapLink() {
		return map_link;
	}
	public void setMapLink(String map_link) {
		this.map_link = map_link;
		super.setRefMap(map_link);
	}
	
	@Column(name="comm")
	public String getKommentar(){
		return kommentar;
	}
	
	public void setKommentar(String kommentar){
		this.kommentar=kommentar;
		super.setComment(kommentar);
	}
}
